<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>tab</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="tb.html" title="tb" />
    <link rel="next" href="table.html" title="table" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">tab</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="tb.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="table.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="tab"></a>
      <div class="titlepage"></div>
      <a id="IndexTabw_i" class="indexterm"></a>
      <a id="IndexTabw" class="indexterm"></a>
      <a id="IndexTab_i" class="indexterm"></a>
      <a id="IndexTab" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">tab</span>
        </h2>
        <p>tab — 
      Fast table opcodes.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp155077152"></a>
        <h2>Description</h2>
        <p>
      Fast table opcodes. Faster than
    <a class="link" href="table.html" title="table"><em class="citetitle">table</em></a> and
    <a class="link" href="tablew.html" title="tablew"><em class="citetitle">tablew</em></a> because don't
    allow wrap-around and limit and don't check index validity. Have
    been implemented in order to provide fast access to
    arrays. Support non-power of two tables (can be generated by any
    GEN function by giving a negative length value). 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp155080576"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ir <span class="command"><strong>tab_i</strong></span> indx, ifn[, ixmode]</pre>
        <pre class="synopsis">kr <span class="command"><strong>tab</strong></span> kndx, ifn[, ixmode]</pre>
        <pre class="synopsis">ar <span class="command"><strong>tab</strong></span> xndx, ifn[, ixmode]</pre>
        <pre class="synopsis"><span class="command"><strong>tabw_i</strong></span> isig, indx, ifn [,ixmode]</pre>
        <pre class="synopsis"><span class="command"><strong>tabw</strong></span> ksig, kndx, ifn [,ixmode]</pre>
        <pre class="synopsis"><span class="command"><strong>tabw</strong></span> asig, andx, ifn [,ixmode]</pre>
      </div>
      <div class="refsect1">
        <a id="idp155089232"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>ifn</em></span> -- table number
    </p>
        <p>
      <span class="emphasis"><em>ixmode</em></span> -- defaults to zero.  If zero
      <span class="emphasis"><em>xndx</em></span> and <span class="emphasis"><em>ixoff</em></span> ranges match the
      length of the table; if non zero <span class="emphasis"><em>xndx</em></span> and
      <span class="emphasis"><em>ixoff</em></span> have a 0 to 1 range. 
    </p>
        <p>
      <span class="emphasis"><em>isig</em></span> -- input value to write.
    </p>
        <p>
      <span class="emphasis"><em>indx</em></span> -- table index
    </p>
      </div>
      <div class="refsect1">
        <a id="idp155095136"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig, ksig</em></span> -- input signal to write.
    </p>
        <p>
      <span class="emphasis"><em>andx, kndx</em></span> -- table index.
    </p>
        <p>
      <span class="emphasis"><em>tab</em></span> and <span class="emphasis"><em>tabw</em></span>
      opcodes are similar to <span class="emphasis"><em>table</em></span> and
      <span class="emphasis"><em>tablew</em></span>, but are faster and support tables
      having non-power-of-two length. 
    </p>
        <p>
      Special care of index value must be taken into account. Index
      values out of the table allocated space will crash Csound. 
    </p>
      </div>
      <div class="refsect1">
        <a id="idp155100384"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the tab opcode. It uses the file <a class="ulink" href="examples/tab.csd" target="_top"><em class="citetitle">tab.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp155102240"></a>
          <p class="title">
            <strong>Example 893. Example of the tab opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac    <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o tab.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

gifn1 <span class="ohdr">ftgen</span> 1, 0, 0, 1, "flute.aiff", 0, 4, 0	<span class="comment">;deferred-size table</span>

<span class="oblock">instr</span> 1 

atab  <span class="opc">init</span> 0 
isize <span class="opc">tableng</span> 1					<span class="comment">;length of table?</span>
<span class="opc">print</span> isize
andx  <span class="opc">phasor</span> 1 <span class="op">/</span> (isize <span class="op">/</span> sr) 
asig  <span class="opc">tab</span> andx, 1, 1				<span class="comment">;has a 0 to 1 range</span>
      <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span> 
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
 

<span class="stamnt">i</span> 1 0 2.3
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp155106480"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="tb.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="table.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">tb </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> table</td>
        </tr>
      </table>
    </div>
  </body>
</html>
